﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Akka.Actor;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            PrintOneToTen();
            PrintMultiplicationTable(19);
            TestAkka();
            Console.WriteLine("press any key to continue...");
            Console.ReadKey();
        }

        static void TestAkka()
        {
            Console.WriteLine("Test AKKA lib");
            var system = ActorSystem.Create("MySystem");
            var greeter = system.ActorOf<GreetingActor>("greeter");
            greeter.Tell(new Greet("World"));
            Console.ReadLine();
        }

        static void PrintOneToTen()
        {
            for (int i = 0; i < 10; i++)
            {
                Console.Write(i + " ");
            }
            Console.WriteLine();
        }

        static void PrintMultiplicationTable(int row)
        {
            for (int i = 1; i <= row; i++)
            {
                for (int j = 1; j <=9; j++)
                {
                    Console.Write(i + "*" + j + "=" + Math.Multiplication(j, i) + " ");
                    if (j==9)
                    {
                        Console.WriteLine();
                    }
                }
            }
        }
    }

    public class Greet
    {
        public Greet(string who)
        {
            Who = who;
        }
        public string Who { get; private set; }
    }

    public class GreetingActor : ReceiveActor
    {
        public GreetingActor()
        {
            // Tell the actor to respond to the Greet message
            Receive<Greet>(greet =>
               Console.WriteLine("Hello {0}", greet.Who));
        }
    }
}